package com.kly.order.db.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.google.common.collect.Maps;
import com.kly.enums.ProductCategory;
import com.kly.enums.ProductStatus;
import com.kly.order.ServiceUtils;
import com.kly.order.db.dao.ProductCategoryDao;
import com.kly.order.db.entity.ProductCategoryEntity;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
* User: linqu
* Date: 2023-06-13
* Time: 15:29:14.339
*/

@Repository
public class ProductCategoryDaoImpl extends AbstractBaseMapper<ProductCategoryEntity> implements ProductCategoryDao {

    @Override
    public List<ProductCategoryEntity> getProductCategoryEntities(String appCode) {
        Map<String, Object> params = Maps.newHashMap();
        params.put("appCode", appCode);
        params.put("status", ProductStatus.ENABLE.getStatus());
        params.put("deleted", 0);
        return selectByParams(params);
//        return this.getSqlSession().selectList(this.getStatement("getProductCategoryEntities"), params);

    }

    @Override
    public ProductCategoryEntity getProductCategory(String appCode, Integer productCategory) {
        Map<String, Object> params = ServiceUtils.getParams();
        params.put("productCategory", productCategory);
        params.put("appCode", appCode);
        return this.getSqlSession().selectOne(this.getStatement("getProductCategory"), params);
    }
}